package examples.books

import de.saxsys.mvvmfx.FxmlView
import de.saxsys.mvvmfx.InjectViewModel
import javafx.fxml.FXML
import javafx.fxml.Initializable
import javafx.scene.control.Label

/**
 * Created by Misty on 2015/6/4.
 */
class BookListItemView implements FxmlView<BookListItemViewModel>, Initializable {
    @FXML
    public Label titleLabel
    @FXML
    public Label authorLabel

    @InjectViewModel
    private BookListItemViewModel viewModel

    BookListItemView(){
        println "create BookListItemView $this"
    }

    @Override
    void initialize(URL location, ResourceBundle resources) {
        titleLabel.textProperty().bind(viewModel.title)
        authorLabel.textProperty().bind(viewModel.author)
    }
}
